<?php

namespace app\controllers;

use app\controllers\action\User;
use core\controller\Controller;
use db\Conn;

class register implements Controller
{
    public static function execute()
    {
        $return = ["code" => 400, "data" => [], "msg" => "注册失败,用户名已存在"];
        $conn = Conn::execute();
        if(User::register($conn, $_POST["id"], $_POST["password"], $_POST["user_type"])) {
            $return["msg"] = "注册成功";
            $return["code"] = 200;
        }

        $conn->close();
        return $return;
    }
}